-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE ModifyEmployee
	-- Add the parameters for the stored procedure here
	@id numeric(8,0),
	@no nvarchar(50),
	@orgNo nvarchar(50),
	@timNo numeric(3,0),
	@lasName nvarchar(50),
	@firName nvarchar(50),
	@expFrom numeric(8,0),
	@expTo numeric(8,0),
	@pasWord nvarchar(50),
	@datOfBirth numeric(8,0),
	@idCard nvarchar(50),
	@homPhone nvarchar(50),
	@celPhone nvarchar(50),
	@regAddress nvarchar(100),
	@curAddress nvarchar(100),
	@email nvarchar(50),
	@marStatus numeric(1,0),
	@expTimFrom numeric(8,0),
	@expTimTo numeric(8,0),
	@gender numeric(1,0)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	UPDATE EMPLOYEE SET TIME_TABLE_NO = @timNo, LAST_NAME = @lasName, FIRST_NAME = @firName,
						EXPIRATION_FROM = @expFrom, EXPIRATION_TO = @expTo, LOGIN_PASSWORD = @pasWord,
						DAY_OF_BIRTH = @datOfBirth, ID_CARD = @idCard, HOME_PHONE= @homPhone,
						CELL_PHONE = @celPhone, REGISTRATION_ADDRESS = @regAddress, CURRENT_ADDRESS = @curAddress,
						EMAIL = @email, MARITAL_STATUS = @marStatus, EXPIRATION_FROM_TIME_TABLE = @expTimFrom,
						EXPIRATION_TO_TIME_TABLE = @expTimTo, GENDER = @gender, UPDATE_DATE_TIME = GETDATE()
					WHERE ID = @id AND EMPLOYEE_NO = @no AND [STATUS] = 0
	
END
GO
